﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="select_course.aspx.cs" Inherits="select_course" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>


    <title>学生选课</title>
    <style type="text/css">
        .auto-style1 {
            text-align: center;
        }
        .auto-style2 {
            font-size: large;
        }
        </style>
</head>
<body>
    <form id="form1" runat="server">
        <div class="auto-style1">
            <br />
            <span class="auto-style2">
            <br />
            <strong>请选择学期：</strong></span><strong><asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="term" DataValueField="term" CssClass="auto-style2" Height="21px" Width="90px">
        </asp:DropDownList>
            <br class="auto-style2" />
            </strong>
        <br />
            <span class="auto-style2"><strong>请选择课程类别：</strong></span><strong><asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3" DataTextField="category" DataValueField="category" CssClass="auto-style2" Height="20px" Width="90px">
        </asp:DropDownList>
            </strong>
        </div>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:XSXKConnectionString4 %>" SelectCommand="SELECT DISTINCT [category] FROM [Course]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XSXKConnectionString4 %>" SelectCommand="select distinct term from course"></asp:SqlDataSource>
        
        <center>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None" AllowPaging="True" AllowSorting="True" DataKeyNames="Cno">
            <AlternatingRowStyle BackColor="White" />
            <Columns>


                <asp:BoundField DataField="Cno" HeaderText="课程号" SortExpression="Cno" ReadOnly="True" />
                <asp:BoundField DataField="Cname" HeaderText="课程名" SortExpression="Cname" />
                <asp:BoundField DataField="category" HeaderText="课程类别" SortExpression="category" />
                <asp:BoundField DataField="priority_no" HeaderText="先修序号" SortExpression="priority_no" />
                <asp:BoundField DataField="credit" HeaderText="学分" SortExpression="credit" />
                <asp:BoundField DataField="term" HeaderText="学期" SortExpression="term" />
                <asp:BoundField DataField="teacher" HeaderText="教师" SortExpression="teacher" />
                <asp:BoundField DataField="address" HeaderText="地点" SortExpression="address" />
                <asp:BoundField DataField="time" HeaderText="时间" SortExpression="time" />
                <asp:HyperLinkField DataNavigateUrlFields="Cno,category,priority_no,term,time,credit,Cname,address" DataNavigateUrlFormatString="select_course_detail.aspx?Cno={0}&amp;category={1}&amp;priority_no={2}&amp;term={3}&amp;time={4}&amp;credit={5}&amp;Cname={6}&amp;address={7}" HeaderText="选课" Text="选课" Target="_parent" />
            </Columns>
            <EditRowStyle BackColor="#7C6F57" />
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D4DFE1" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
        </asp:GridView>
            </center>

        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:XSXKConnectionString4 %>" SelectCommand="SELECT [Cno], [Cname], [category], [priority_no], [credit], [term], [teacher], [address], [time], [major], [introduce], [capacity] FROM [Course] WHERE (([term] = @term) AND ([category] = @category))">
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" Name="term" PropertyName="SelectedValue" Type="Int32" />
                <asp:ControlParameter ControlID="DropDownList2" Name="category" PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </form>
</body>
</html>
